import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path:'/',
    redirect:'/home/index'
  }, 
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    children:[
      {
        path:'index',
        name:'/home/index',
        component:()=>import('../views/index/Index.vue')
      },
      {
        path:'yanxuan',
        name:'/home/yanxuan',
        component:()=>import('../views/yanxuan/Yanxuan.vue')
      },
      {
        path:'xianzhi',
        name:'/home/xianzhi',
        component:()=>import('../views/xianzhi/Xianzhi.vue')
      },
      {
        path:'service',
        name:'/home/service',
        component:()=>import('../views/service/Service.vue')
      },
      {
        path:'mine',
        name:'/home/mine',
        component:()=>import('../views/mine/Mine.vue')
      },
    ]
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
